package cn.xmstore.controller;

import cn.xmstore.entity.Account;
import cn.xmstore.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

/**
 * 框架测试Controller
 *
 * @Author aeolia
 * @Date 2021/8/11 17:49
 */

@Controller
@RequestMapping("/account")
public class AccountController {

    @Autowired
    private AccountService accountService;

    @RequestMapping("/findAll")
    public String findAll() {
        System.out.println("表现层：查询所有账户信息");
        //调用service层
        List<Account> accounts = accountService.findAll();
        if (accounts != null) {
            for (Account account : accounts) {
                System.out.println(account);
            }
        }
        return "success";
    }
}
